@extends('layouts.master')
@section('title')
    登录-钢链网
@stop

@section('app_css')
    <link type="text/css" rel="stylesheet" href="/resource/css/bootstrap.min.css" >
    <link rel="stylesheet" type="text/css" href="/resource/css/login.css">
@stop

@section('app_js')
    <script src="/resource/js/jquery-1.11.3.min.js"></script>
    <script src="/resource/js/Jq_place.js"></script>
    <script>
            $('#captcha').blur(function(){
                var captcha =  document.getElementById('captcha').value;
                var status = false;
                if(captcha){
                    var ajax = new XMLHttpRequest();
                    ajax.onreadystatechange = function () {
                        if (ajax.readyState == 4) {
                            if (ajax.responseText == 1) {
                                $("#t_captcha").hide();
                                status = true
                            } else {
                                alert("验证码错误");
                            }
                        }
                    }
                    //与服务器建立连接
                    ajax.open('post', '/admin/js_verify_register', false);
                    ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    //处理请求
                    ajax.send('captcha=' + captcha);
                    return status
                }else{
                    return false;
                }
            });

function check_id(){
    var captcha =  document.getElementById('captcha').value;
    var status = false;
    if(captcha){
        var ajax = new XMLHttpRequest();
        ajax.onreadystatechange = function () {
            if (ajax.readyState == 4) {
                if (ajax.responseText == 1) {
                    $("#t_captcha").hide();
                    status = true
                } else {
                    alert("验证码错误");
                }
            }
        }
        //与服务器建立连接
        ajax.open('post', '/admin/js_verify_register', false);
        ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        //处理请求
        ajax.send('captcha=' + captcha);
        return status
    }else{
        return false;
    }
}
    </script>
@stop
@section('content')
    <div class="bg"></div>
    <div class="cont">
        <div class="logo"></div>
        <div class="title">后台管理系统</div>
        <form class="form" action="/admin/depose_login" method="post" onsubmit="return check_id()">
            <div class="form-group">
                <input style="behavior:url(/resource/css/ie-css3.htc);" type="text" name="username" class="form-control" placeholder="账户 User" value="">
                <i class="glyphicon glyphicon-user"></i>
            </div>
            <div class="form-group">
                <input style="behavior:url(/resource/css/ie-css3.htc);" type="password" name="password" class="form-control" placeholder="密码 Password" value="">
                <i class="glyphicon glyphicon-lock"></i>
            </div>
            <div class="form-group">
                <input style="behavior:url(/resource/css/ie-css3.htc);" name="captcha" type="text"  class="form-control proving" placeholder="验证码" id="captcha">
                {{--<div class="proving-code" style="behavior:url(ie-css3.htc);"><img src="/resource/img/yzm_pic.png"></div>--}}
                <div class="proving-code" style="behavior:url(ie-css3.htc);"><img onclick="this.src='/captcha?'+ Math.random()"  src="/captcha"></div>
                <div id="t_captcha" hidden>验证码错误</div>
            </div>
            <button style="behavior:url(/resource/css/ie-css3.htc);" type="submit" class="btn btn-color">登录</button>
        </form>
        <!-- <a href="#">忘记密码？</a> -->
    </div>
@stop

